<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="shortcut icon" href="imagens/caminhao.ico" />
    <title>Eduardo Encomendas</title>

	<link rel="stylesheet" href="js/formee/css/formee-structure.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="js/formee/css/formee-style.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="js/jVal/jVal.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="js/message/codebase/themes/message_default.css" type="text/css" media="screen" />
	
	<script type="text/javascript" src="jquery/js/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="js/jVal/jVal.js"></script>
    <script type="text/javascript" src='js/util.js'></script>
    <script type="text/javascript" src='js/message/codebase/message.js'></script>
	
	<style type="text/css">
		* {margin:0;padding:0;}
		/* fix  ff bugs */
		
		form {clear:both;}
		.container {margin:0 auto; height:100%;padding:0 40px;}
		.footer, .footer a {color:#fff;}
		.left {float:left;}
		.right {float:right;}
		.topbar {
			background: #fafafa;
			padding: 10px 30px;
		  border-bottom:1px solid #e9e9e9;
		}
	</style>
	
	<script type="text/javascript">
		$(function() {
			$( "input[type=submit], a, button" )
		    .click(function( event ) {
		        event.preventDefault();
			});
		});

		jQuery.fn.reset = function () {
			$(this).each (function() { this.reset(); });
		};
		
		$(document).ready(function() {
			$("#btnEntrar").click(function(event){
				if ( $('#form').jVal({style:'cover',padding:3,border:1,wrap:true}) ) 
					autenticarUsuario();
			});

			$("#btnLimpar").click(function(event){
				$("#form").reset();
			});
		});

		function autenticarUsuario() {
			var parametros = "Login=" + $('#txtUsuario').val() + "&Senha=" + $('#txtSenha').val();
			var retorno = servico("aplicacao/controller/LoginController.php?acao=autenticar", "json", parametros);
			if (retorno == "ok") {
				window.location = "index.php";
			} else {
				dhtmlx.alert({
					type:"alert-error",
					text:"Login inv&aacute;lido"
				});
			}
		}
	</script>

</head>

<body>
    	
<div class="container" style="width: 500px; position:absolute; left:50%; top:50%; margin-left:-250px; margin-top:-150px;">

	<!-- formee-->
	<form id="form" class="formee" action="">
	    <fieldset>
			<legend>Login&nbsp;&nbsp;</legend>
	    	<div class="login">
	            <div class="grid-12-12">
					<label>Usu&aacute;rio <em class="formee-req">*</em></label>
					<input type="text" id="txtUsuario" maxlength="10"
						jVal="{valid:function (val) { if (val.length == 0) return false; else return true; }, message:'Usu&aacute;rio inv&aacute;lido'}" />
	            </div>
	            <div class="grid-12-12 clear">
					<label>Senha <em class="formee-req">*</em></label>
					<input type="password" id="txtSenha" maxlength="10"
						jVal="{valid:function (val) { if (val.length == 0) return false; else return true; }, message:'Senha inv&aacute;lida'}"/>
	            </div> 
	            <div class="grid-6-12 clear">
	            </div>
	            <div class="grid-6-12">
					<input class="right" type="submit" id="btnEntrar" title="Entrar" value="Entrar" />
					<input class="right" type="submit" id="btnLimpar" title="Limpar" value="Limpar" />
	            </div>
	        </div>
	    </fieldset>
	</form>

</div>

</body>
</html>
